/*
 * create on 2012-2-6
 * Copy right (2012)
 * eking All rights reserved
 */
package com.myway.core.common;

import java.util.HashMap;

/**
 * 类名称：SMSSendStatus <br/>
 * 类描述：短信发送状态 <br/>
 * 创建时间：2015年12月8日 下午3:33:14 <br/>
 * @author 张涛
 * @version V1.0
 */
public enum SMSSendStatus {
	SENDING("SENDING"),			//发送中 
	FAIL("FAIL"),               //发送失败
	SUCCESS("SUCCESS"),	        //发送成功
	ERROR("ERROR");	            //重发异常
	
	private final String alias;

	private static HashMap<String, SMSSendStatus> map;

	static {
		map = new HashMap<String, SMSSendStatus>();
		for (SMSSendStatus status : SMSSendStatus.values()) {
			map.put(status.alias, status);
		}
	}

	SMSSendStatus(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	public String getAlias() {
		return alias;
	}

	public static SMSSendStatus valueOfAlias(String alias) {
		SMSSendStatus status = map.get(alias);

		if (status == null) {
			throw new IllegalArgumentException("Unknown sms send status alias [" + alias + "]");
		}

		return status;
	}
}
